package org.feiye.studyday18;

import java.util.Scanner;

public class ExceptionDemo1 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		double sum = 0;
		double avg = 0;
		try {
			for (int i = 0; i < 5; i++) {
				System.out.println("请输入第" + (i + 1) + "门课的学时：");
				double time = in.nextDouble();
				sum += time;
			}
			avg = sum / 5;
			System.out.println(avg);
		} catch (Exception e) {
			System.err.println("出现异常错误！");
			e.printStackTrace();
		} finally {
			System.out.println("欢迎光临！！！！！！！！！！！！！！！！！！");
		}

	}

}
